<admintpl file="header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="javascript:;">{:L('MATCH_INDEX')}</a></li>
			<li><a href="{:U('Match/add')}" target="_self">{:L('MATCH_ADD')}</a></li>
		</ul>
		<form class="well form-search" method="post" action="{:U('Match/index')}">
			时间：
			<select id="timeSelect" style="width: 120px;" name="timeSelect">
			</select>&nbsp;&nbsp;
			比赛名称：
			<input type="text" name="keyword" style="width: 200px;" value="{$formget.keyword|default=''}" placeholder="请输入关键字...">
			<input type="submit" class="btn btn-primary" value="搜索" />
			<a class="btn btn-danger" href="{:U('Match/index')}">清空</a>
		</form>
		<form class="js-ajax-form" action="" method="post">
			<table class="table table-hover table-bordered table-list">
				<thead>
					<tr>
						<th width="50">ID</th>
						<th width="50">比赛名称</th>
						<th width="70">比赛时间</th>
						<th width="70">操作</th>
					</tr>
				</thead>
				<foreach name="posts" item="vo">
				<tr>
					<td>{$key+1}</td>
					<td>{$vo.name}</td>
					<td>{$vo.time}</td>
					<td>
						<a href="{:U('Match/edit',array('id'=>$vo['id']))}">编辑</a> |
						<a href="javascript:void(0)" onclick="deleteItem({$vo.id})">删除</a>
					</td>
				</tr>
				</foreach>
			</table>
			<div class="pagination">{$page}</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script src="__PUBLIC__/js/layer/layer.js"></script>
	<script>
		$(function () {
			var thisYear=new Date().getUTCFullYear();
			var startYear;
            for(startYear=thisYear-10;startYear<thisYear+10;startYear++){
                if(startYear!=thisYear){
                    $("#timeSelect").append("<option>"+startYear+"</option>");
				}else{
                    $("#timeSelect").append("<option selected='selected'>"+startYear+"</option>");
				}
            }
        })
		function deleteItem(id) {
			layer.confirm('您确定删除该比赛？', {
				btn: ['确定','取消'] //按钮
			},function(){
				$.ajax({
					type: "POST",
					url: "{:U('Match/delete')}",
					data: {id:id},
					success: function(result) {
						var result=eval("("+result+")");
						if(result.status){
							layer.msg(result.message,{time:500},function(){
								location.href = "{:U('Match/index')}";
							});
						}else{
							layer.msg(result.message);
						}
					}
				});
			});
		}
	</script>
</body>
</html>